import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout'
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/pageLogin.vue')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/PageSearch.vue')
  },
  {
    path: '/article',
    name: 'article',
    component: () => import('../views/layout/PageHome/articleDetailDetail.vue')
  },
  {
    path: '/info',
    name: 'info',
    component: () => import('../views/layout/PageMy/userInformation.vue')
  },
  {
    path: '/layout',
    component: () => import('../views/PageLayout.vue'),
    children:[
      {
        path: '',
        redirect: '/layout/home'
      },
      {
        path: 'home',
        name: 'home',
        component: () => import('../views/layout/PageHome.vue')
      },
      {
        path: 'QA',
        name: 'QA',
        component: () => import('../views/layout/PageQ_A.vue')
      },
      {
        path: 'video',
        name: 'video',
        component: () => import('../views/layout/PageVideo.vue')
      },
      {
        path: 'my',
        name: 'my',
        component: () => import('../views/layout/PageMy.vue')
      },
    ]
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
